import basePage from '../../core/basePage.js'

Page(basePage({
  data: {
    dialogShow: false, // 是否开启弹窗
  },
  onLoad() {
    console.log(this.data)
  },
  // 播放进度变化时触发，触发频率 250ms 一次
  bindtimeupdate(e) {
    let { currentTime, duration } = e.detail
    console.log(currentTime)
    if (currentTime >= 5) {
      let videoContext = wx.createVideoContext('video')
      videoContext.pause()
      this.openDialog()
    }
  },
  // 开启弹窗
  openDialog() {
    this.setData({
      dialogShow: true
    })
  },
  // 关闭弹窗
  closeDialog() {
    this.setData({
      dialogShow: false
    })
  }
}))